package com.sghj.Interceptor;

import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

/**
 * @author xrx
 * @Date 2022/2/14
 * @apiNote
 */

public class MyShiroFilter extends FormAuthenticationFilter {
    @Override
    protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) {
        HttpServletRequest req = (HttpServletRequest) request;

        String method = req.getMethod();

        if (method.toUpperCase().equals("OPTIONS")){
            return true;
        }
        return super.isAccessAllowed(request, response, mappedValue);
    }
}
